package requests

import (
	"github.com/goravel/framework/contracts/http"
	"github.com/goravel/framework/contracts/validation"
)

type CategoryRequest struct {
	Pid int64 `json:"pid" form:"pid"`

	OwnerId int64 `json:"owner_id" form:"owner_id"`

	Name string `json:"name" form:"name"`

	Sort int64 `json:"sort" form:"sort"`

	Type int64 `json:"type" form:"type"`

	Other string `json:"other" form:"other"`
}

func (r *CategoryRequest) Authorize(ctx http.Context) error {
	return nil
}

func (r *CategoryRequest) Rules(ctx http.Context) map[string]string {
	return map[string]string{

		"pid": "required",

		"owner_id": "required",

		"name": "required",

		"sort": "required",

		"type": "required",

		"other": "required",
	}
}

func (r *CategoryRequest) Messages(ctx http.Context) map[string]string {
	return map[string]string{}
}

func (r *CategoryRequest) Attributes(ctx http.Context) map[string]string {
	return map[string]string{}
}

func (r *CategoryRequest) PrepareForValidation(ctx http.Context, data validation.Data) error {
	return nil
}
